package com.acwing.partition34;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/5/20 16:56
 */
public class AC3371舒适的奶牛 {

    private static final int N = 1010;
    private static final int[][] dirs = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}};
    private static boolean[][] g = new boolean[N][N];
    private static int n;

    private static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    private static PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        n = nextInt();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            int x = nextInt(), y = nextInt();
            g[x][y] = true;
            int c = get(x, y), nc = 0;
            if (c == 3) ans++;
            for (int[] dir : dirs) {
                int nx = x + dir[0], ny = y + dir[1];
                if (nx < 0 || nx >= N || ny < 0 || ny >= N || !g[nx][ny]) continue;
                nc = get(nx, ny);
                if (nc == 3) ans++;
                else if (nc == 4) ans--;
            }
            writer.println(ans);
        }
        writer.flush();
    }

    private static int get(int x, int y) {
        int res = 0;
        for (int[] dir : dirs) {
            int nx = x + dir[0], ny = y + dir[1];
            if (nx < 0 || nx >= N || ny < 0 || ny >= N || !g[nx][ny]) continue;
            res++;
        }
        return res;
    }

    private static int nextInt() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }
}
